home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / MELL / NETLIB00 / NetLib / c / ntoa < prev    next >
Text File  |  1995-02-28  |  398b  |  20 lines

  1. #include <stdio.h>
  2.  
  3. #include "arpa/inet.h"
  4. #include "netinet/in.h"
  5.  
  6. /*
  7.  * Format an internet address in string form
  8.  */
  9. char *inet_ntoa(struct in_addr in)
  10. {
  11.   static char string[16];
  12.  
  13.   /* Print the string into the buffer */
  14.   sprintf(string, "%ld.%ld.%ld.%ld", in.s_addr & 0xff,
  15.           (in.s_addr >> 8) & 0xff, (in.s_addr >> 16) & 0xff,
  16.           (in.s_addr >> 24) & 0xff);
  17.  
  18.   return string;
  19. }
  20.